package com.zhazha.stand.controller;

import java.util.List;
import java.util.ArrayList;

import com.opensymphony.xwork2.ActionContext;

import com.zhazha.stand.logic.impl.InformationLogicImpl;
import com.zhazha.stand.model.DepartmentScoreModel;
import com.zhazha.stand.model.LevelScoreModel;
import com.zhazha.stand.model.UserScoreModel;

public class InformationController extends BaseController{
	
	private List<UserScoreModel> userScoreList = null;
	private List<DepartmentScoreModel> dmScoreList = null;
	private List<LevelScoreModel> levelScoreList = null;
	private InformationLogicImpl inforLogic = new InformationLogicImpl();
	
	public String getAllUserScoreList() {
		
		userScoreList = inforLogic.getAllUserScoreList(this.getIntParam("contestId"));
		if (null == userScoreList)
			return ERROR;
		ActionContext.getContext().put("AllUserScoreList", userScoreList);
		return SUCCESS;
	}
	
	public String getDepartmentScoreList() {
		
		dmScoreList = inforLogic.getDepartmentScoreList(this.getIntParam("contestId"));
		if (null == dmScoreList)
			return ERROR;
		ActionContext.getContext().put("DepartmentScoreList", dmScoreList);
		return SUCCESS;
	}
	
	public String getGrdAverageScore() {
		float score = inforLogic.getGrdAverageScore(this.getIntParam("contestId"));
		ActionContext.getContext().put("GrdAverageScore", score);
		return SUCCESS;
	}
	
	public String getNotGrdAverageScore() {
		float score = inforLogic.getNotGrdAverageScore(this.getIntParam("contestId"));
		ActionContext.getContext().put("NotGrdAverageScore", score);
		return SUCCESS;
	}
	
	public String getLevelAverageScore() {
		levelScoreList = inforLogic.getLevelAverageScore(this.getIntParam("contestId"));
		if (null == levelScoreList)
			return ERROR;
		ActionContext.getContext().put("LevelAverageScore", levelScoreList);
		return SUCCESS;
	}
	
	public String execute() {
		
		return SUCCESS;
	}

}
